<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试用例管理 - 智能测试用例生成系统</title>
    
    <!-- Favicon -->
    <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🧪</text></svg>">
    
    <!-- 预加载关键资源 -->
    <link rel="preload" href="/static/css/teacher.css" as="style">
    
    <!-- CSS资源 - 使用本地资源 -->
    <link href="/static/css/teacher.css" rel="stylesheet">
    
    <!-- 简化的Bootstrap替代样式 -->
    <style>
        /* 基础样式 */
        .btn {
            display: inline-block;
            padding: 0.375rem 0.75rem;
            margin-bottom: 0;
            font-size: 1rem;
            font-weight: 400;
            line-height: 1.5;
            text-align: center;
            text-decoration: none;
            vertical-align: middle;
            cursor: pointer;
            border: 1px solid transparent;
            border-radius: 0.25rem;
            transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
        }
        .btn-primary {
            color: #fff;
            background-color: #0d6efd;
            border-color: #0d6efd;
        }
        .btn-primary:hover {
            color: #fff;
            background-color: #0b5ed7;
            border-color: #0a58ca;
        }
        .btn-secondary {
            color: #fff;
            background-color: #6c757d;
            border-color: #6c757d;
        }
        .btn-success {
            color: #fff;
            background-color: #198754;
            border-color: #198754;
        }
        .btn-danger {
            color: #fff;
            background-color: #dc3545;
            border-color: #dc3545;
        }
        .btn-outline-primary {
            color: #0d6efd;
            border-color: #0d6efd;
            background-color: transparent;
        }
        .btn-outline-danger {
            color: #dc3545;
            border-color: #dc3545;
            background-color: transparent;
        }
        .btn-sm {
            padding: 0.25rem 0.5rem;
            font-size: 0.875rem;
            border-radius: 0.2rem;
        }
        .table {
            width: 100%;
            margin-bottom: 1rem;
            color: #212529;
            border-collapse: collapse;
        }
        .table th, .table td {
            padding: 0.75rem;
            vertical-align: top;
            border-top: 1px solid #dee2e6;
        }
        .table thead th {
            vertical-align: bottom;
            border-bottom: 2px solid #dee2e6;
        }
        .table-striped tbody tr:nth-of-type(odd) {
            background-color: rgba(0,0,0,.05);
        }
        .table-hover tbody tr:hover {
            background-color: rgba(0,0,0,.075);
        }
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            z-index: 1055;
            width: 100%;
            height: 100%;
            overflow-x: hidden;
            overflow-y: auto;
            outline: 0;
        }
        .modal-dialog {
            position: relative;
            width: auto;
            margin: 0.5rem;
            pointer-events: none;
        }
        .modal-content {
            position: relative;
            display: flex;
            flex-direction: column;
            width: 100%;
            pointer-events: auto;
            background-color: #fff;
            background-clip: padding-box;
            border: 1px solid rgba(0,0,0,.2);
            border-radius: 0.3rem;
            outline: 0;
        }
        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1rem;
            border-bottom: 1px solid #dee2e6;
            border-top-left-radius: calc(0.3rem - 1px);
            border-top-right-radius: calc(0.3rem - 1px);
        }
        .modal-body {
            position: relative;
            flex: 1 1 auto;
            padding: 1rem;
        }
        .modal-footer {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;
            padding: 0.75rem;
            border-top: 1px solid #dee2e6;
            border-bottom-right-radius: calc(0.3rem - 1px);
            border-bottom-left-radius: calc(0.3rem - 1px);
        }
        .btn-close {
            box-sizing: content-box;
            width: 1em;
            height: 1em;
            padding: 0.25em 0.25em;
            color: #000;
            background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.5.5 15 15M.5 15.5 15.5.5'/%3e%3c/svg%3e") no-repeat center;
            background-size: 1em;
            border: 0;
            border-radius: 0.25rem;
            opacity: 0.5;
        }
        .btn-close:hover {
            color: #000;
            text-decoration: none;
            opacity: 0.75;
        }
        .badge {
            display: inline-block;
            padding: 0.35em 0.65em;
            font-size: 0.75em;
            font-weight: 700;
            line-height: 1;
            color: #fff;
            text-align: center;
            white-space: nowrap;
            vertical-align: baseline;
            border-radius: 0.25rem;
        }
        .bg-primary { background-color: #0d6efd !important; }
        .bg-secondary { background-color: #6c757d !important; }
        .bg-success { background-color: #198754 !important; }
        .bg-danger { background-color: #dc3545 !important; }
        .bg-info { background-color: #0dcaf0 !important; }
        .text-center { text-align: center !important; }
        .text-muted { color: #6c757d !important; }
        .fw-bold { font-weight: 700 !important; }
        .d-flex { display: flex !important; }
        .d-none { display: none !important; }
        .gap-1 > * + * { margin-left: 0.25rem !important; }
        .mt-2 { margin-top: 0.5rem !important; }
        .mt-3 { margin-top: 1rem !important; }
        .py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
        .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
        .me-1 { margin-right: 0.25rem !important; }
        .me-2 { margin-right: 0.5rem !important; }
        .mb-0 { margin-bottom: 0 !important; }
        .small { font-size: 0.875em; }
        .table-responsive {
            display: block;
            width: 100%;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
        .empty-state {
            text-align: center;
            padding: 2rem;
            color: #6c757d;
        }
        .empty-state i {
            font-size: 3rem;
            margin-bottom: 1rem;
        }
    </style>
</head>
<body>
    <!-- 现代化导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-modern fixed-top">
        <div class="container">
            <a class="navbar-brand-modern" href="/">
                <i class="fas fa-code"></i>
                <span>智能测试用例生成系统</span>
            </a>
            
            <div class="navbar-nav-modern">
                <a class="nav-link-modern" href="/">首页</a>
                <a class="nav-link-modern" href="/#analyzer">智能分析</a>
                <a class="nav-link-modern active" href="/teacher">测试用例管理</a>
                <a class="nav-link-modern" href="/#statistics">统计信息</a>
            </div>
        </div>
    </nav>

    <!-- 页面头部 -->
    <section class="teacher-header">
        <div class="container">
            <h1>
                <i class="fas fa-database me-3"></i>
                测试用例管理
            </h1>
            <p class="lead">管理、编辑和复用测试用例，提高教学效率</p>
            
            <!-- 统计信息 -->
            <div class="stats-container">
                <div class="stats-card">
                    <h3 id="totalTestCases">0</h3>
                    <small>总测试用例</small>
                </div>
                <div class="stats-card">
                    <h3 id="totalSets">0</h3>
                    <small>总问题数</small>
                </div>
            </div>
        </div>
    </section>

    <!-- 主要内容 -->
    <section class="main-content">
        <div class="container">
            <!-- 页面标题和操作按钮 -->
            <div class="page-header">
                <div class="page-actions">
                    <button class="btn btn-primary" onclick="window.location.href='/new-test-case'">
                        <i class="fas fa-plus me-2"></i>新建测试用例
                    </button>
                    <button class="btn btn-warning" onclick="importTestCases()">
                        <i class="fas fa-upload me-2"></i>导入测试用例
                    </button>
                </div>
            </div>

            <div class="row">
                <!-- 问题库 -->
                <div class="col-12">
                    <div class="problem-library">
                        <div class="card-header">
                            <h5>
                                <i class="fas fa-question-circle me-2"></i>
                                问题库
                            </h5>
                        </div>
                        
                        <!-- 搜索和过滤控件 -->
                        <div class="card-body border-bottom">
                            <div class="row g-3">
                                <div class="col-md-4">
                                    <div class="input-group">
                                        <input type="text" class="form-control" id="searchInput" 
                                               placeholder="搜索问题描述..." 
                                               onkeypress="if(event.key==='Enter') performSearch()">
                                        <button class="btn btn-outline-secondary" type="button" onclick="performSearch()" title="搜索问题">
                                            <i class="fas fa-search"></i>搜索
                                        </button>
                                        <button class="btn btn-outline-secondary" onclick="clearFilters()" title="清除所有过滤条件">
                                            <i class="fas fa-times me-1"></i>清除
                                        </button>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="input-group">
                                        <select class="form-select" id="problemTypeFilter">
                                            <option value="">所有问题类型</option>
                                            <option value="addition">加法</option>
                                            <option value="subtraction">减法</option>
                                            <option value="multiplication">乘法</option>
                                            <option value="division">除法</option>
                                            <option value="array">数组操作</option>
                                            <option value="string">字符串处理</option>
                                            <option value="math">数学计算</option>
                                            <option value="other">其他</option>
                                        </select>
                                        <button class="btn btn-primary" onclick="applyFilters()" title="应用类型过滤">
                                            <i class="fas fa-filter me-1"></i>过滤
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 问题表格 -->
                        <div class="card-body p-0">
                            <div id="problemLibrary">
                                <div class="text-center py-4">
                                    <i class="fas fa-spinner fa-spin fa-2x text-primary"></i>
                                    <p class="text-muted mt-2">正在加载问题库...</p>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 分页控件 -->
                        <div class="card-footer">
                            <div id="paginationControls"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 页脚 -->
    <footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-links">
                    <a href="/">首页</a>
                    <a href="/#analyzer">智能分析</a>
                    <a href="/teacher">测试用例管理</a>
                    <span>&copy;智能测试用例生成系统</span>
                </div>
            </div>
        </div>
    </footer>

    <!-- 预加载JavaScript资源 -->
    <link rel="preload" href="/static/js/teacher.js" as="script">
    
    <!-- 简化的Bootstrap JavaScript替代 -->
    <script>
        // 简化的Bootstrap Modal功能
        window.bootstrap = {
            Modal: {
                getInstance: function(element) {
                    return null; // 简化实现
                }
            }
        };
        
        // 简化的模态框功能
        function showModal(modalId) {
            const modal = document.getElementById(modalId);
            if (modal) {
                modal.style.display = 'block';
                modal.classList.add('show');
                document.body.classList.add('modal-open');
            }
        }
        
        function hideModal(modalId) {
            const modal = document.getElementById(modalId);
            if (modal) {
                modal.style.display = 'none';
                modal.classList.remove('show');
                document.body.classList.remove('modal-open');
            }
        }
    </script>
    
    <!-- 教师管理功能JavaScript -->
    <script src="/static/js/teacher.js"></script>
</body>
</html>